﻿<Serializable()> _
Public Class Funcionario
    Inherits Pessoa

    Private _CTPS As String
    Public Overridable Property CTPS() As String
        Get
            Return _CTPS
        End Get
        Set(ByVal value As String)
            _CTPS = value
        End Set
    End Property

#Region "Negocio"

    Public Sub New()
        MyBase.New()
    End Sub

    Public Overridable Function Buscar(ByVal _id As Long) As Funcionario
        Return MyBase.FuncionarioDao.Buscar(_id)
    End Function

    Public Overridable Function BuscarPorNome(ByVal _nome As String) As List(Of Funcionario)

        Return MyBase.FuncionarioDao.BuscarPorNome(_nome)

    End Function

    Public Overridable Function BuscarPorCPF(ByVal _cpf As String) As List(Of Funcionario)

        Return MyBase.FuncionarioDao.BuscarPorCPF(_cpf)

    End Function

    Public Overridable Sub Salvar()

        If String.IsNullOrEmpty(Me.Nome) Then
            Throw New ArtNoiException("É necessário informar o nome do Funcionário.")
        End If

        MyBase.FuncionarioDao.Salvar(Me)
    End Sub

#End Region

End Class